package d7_tz;


import java.util.concurrent.atomic.AtomicInteger;

public class MyRunnable2 implements Runnable {
    private int number=0;//记录浏览量
    //整数修改的乐观锁
    private AtomicInteger atomicInteger=new AtomicInteger();

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            number +=1;
            synchronized (MyRunnable.class) {
                System.out.println("count=======>"+atomicInteger.incrementAndGet());
            }
        }
    }
}
